a = [90, 29, 89, 77, 34, 92, 99, 1, 65,4564,98941,986898,16461]
# 归并排序
def sort(lst):
    mid = len(lst)//2
    if len(lst) >1:
        left = sort(lst[:mid])
        right = sort(lst[mid:])
        return close(left, right)
    else:
        print("dkajdownd")
        return lst

def close(left,right):
    readdao = []
    while left and right:
        if left[0]>right[0]:
            readdao.append(right.pop(0))
        else:
            readdao.append(left.pop(0))
    return  readdao + right + left


print(sort(a))

